package edu.tamu.cse.teamproject1.Database.Interfaces;

import edu.tamu.cse.teamproject1.Database.ColumnDefinition;
import edu.tamu.cse.teamproject1.Database.EnumColumnType;

/**
 * Describes a Column
 * 
 * This interface provides the method definitions for our ColumnDefinition class. 
 * The ColumnDefinition class is a container that describes how a column is 
 * constructed. See the {@link ColumnDefinition} class for more information on 
 * what comprises of a column definition. 
 * 
 * @author Christopher Weldon <chris@chrisweldon.net>
 * @since Release 0.1.0
 */
public interface IColumnDefinition extends Cloneable {
    /**
     * Retrieves the column name
     *
     * @return The database column name
     */
    String getColumnName();

    /**
     * Sets the column name
     *
     * @param String columnName Name of column
     * @return void
     */
    void setColumnName(String columnName);

    /**
     * Gets the column type
     *
     * The column type is an Enum of {@link EnumColumnType}. 
     *
     * @return The column type
     */
    EnumColumnType getColumnType();

    /**
     * Sets the column type
     *
     * @param EnumColumnType columnType The Enum of the column type
     * @return void
     */
    void setColumnType(EnumColumnType columnType);

    /**
     * Gets the column size
     *
     * The column size may be NULL depending on the type of 
     * column (e.g. integer column).
     *
     * @return The column size
     */
    int getColumnSize(); // not required

    /**
     * Sets the column size 
     *
     * The column size may be NULL depending on the type of
     * column (e.g. integer column).
     *
     * @param int columnSize The size of the column
     * @return void
     */
    void setColumnSize(int columnSize);

     /**
      * Is the column capable of being null?
      *
      * @return boolean Is the column capable of being null?
      */
    boolean isNullable();

    /**
     * Sets whether the column is capable of being nullable
     *
     * @param boolean nullable Is the column capable of being null?
     * @return void
     */
    void setNullable(boolean nullable);

    /**
     * Creates a tuple element of this type
     *
     * Takes in a value and clones this objec to create a child object
     * with all metadata information already associated with it.
     *
     * @param Object value Value for the TupleElement
     * @return TupleElement
     */
    ITupleElement createTupleElement(Object value, String columnName);
    
    /**
     * Creates an empty tuple element
     * 
     * @return TupleElement
     */
    ITupleElement createEmptyTupleElement();
    
    /**
     * Provides the cloning definition for code operating on interfaces
     * 
     * @return A copy of this definition
     */
    Object clone();
    
    /**
     * 
     * @return whether this column is a key
     */
    boolean isKey();
    
    /**
     * Sets the column definition as a key
     * 
     * @param keyIs
     */
    void setAsKey(boolean keyIs);
};